package grape.auth.rest.auth2.email;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * 自定义一个provide目前主要为了app用户手机号验证码登录
 * Created by yangwei
 * Created at 2020/7/28 13:37
 */
public class EmailAuthenticationProvider extends DaoAuthenticationProvider {

    @Override
    public boolean supports(Class<?> authentication) {
        return (EmailAuthenticationToken.class
                .isAssignableFrom(authentication));
    }


    @Override
    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        //todo 这里 验证验证码
    }
}
